package com.lnking.lnkingplace.model.dto.inspect;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.lnking.starter.export.annotation.TableColumn;
import com.lnking.starter.export.annotation.TableInfo;
import com.lnking.starter.mybatis.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
@TableInfo(tableName = "检查信息总表")
public class InspectDto extends BaseEntity {

    @ApiModelProperty(value = " 方案名称")
    @TableColumn(columnName = "方案名称",column = "0")
    private String name;

    @ApiModelProperty(value = "检查日期")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @TableColumn(columnName = "检查日期",column = "2")
    private LocalDate inspectTime;

    @ApiModelProperty(value = "创建日期")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "创建人id")
    private String createId;

    @ApiModelProperty(value = "创建人")
    @TableColumn(columnName = "创建人",column = "1")
    private String createName;

    @ApiModelProperty(value = "参与组（;隔开）")
    @TableColumn(columnName = "参与组",column = "3")
    private String groupNames;

    @ApiModelProperty(value = "目标场所（;隔开）")
    private String placeIds;

    @ApiModelProperty(value = "参与人员数量")
    private Integer groupListNum;

    @ApiModelProperty(value = "目标场所数量")
    @TableColumn(columnName = "目标场所数量",column = "4")
    private Integer placeIdsNum;

    @ApiModelProperty(value = "类型")
    @TableColumn(columnName = "检查内容",column = "5")
    private String type;




    public Integer getGroupListNum() {
        return groupNames != null&&!"".equals(groupNames) ? groupNames.split(";").length : 0;
    }

    public Integer getPlaceIdsNum() {
        return placeIds != null&&!"".equals(placeIds) ? placeIds.split(";").length : 0;
    }
}
